Skip to content

[AURON #2378] Support runtime filters in native Iceberg scan#2379

Open
lyne7-sc wants to merge 11 commits into
apache:masterfrom
lyne7-sc:feat/iceberg_runtime_filter
Open

[AURON #2378] Support runtime filters in native Iceberg scan#2379
lyne7-sc wants to merge 11 commits into
apache:masterfrom
lyne7-sc:feat/iceberg_runtime_filter

Conversation

@lyne7-sc

@lyne7-sc lyne7-sc commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #2378

Rationale for this change

Spark's BatchScanExec can carry runtime filters for dynamic partition pruning. These filters are resolved after planning and can reduce the input partitions/files that a scan should read.

Auron's native Iceberg scan should preserve and apply these runtime filters so dynamic partition pruning can reduce Iceberg scan work on the native path.

What changes are included in this PR?

  • Pass BatchScanExec.runtimeFilters into NativeIcebergTableScanExec.
  • Re-plan the Iceberg scan with runtime filters before native execution.
  • Cache runtime-filtered Iceberg scan plans separately from static scan plans.
  • Add a shim method to copy BatchScanExec with runtime filters across supported Spark versions.
  • Add Iceberg integration tests for:
    • Parquet native scan with dynamic partition pruning;
    • ORC native scan with dynamic partition pruning;
    • dynamic pruning to empty partitions;
    • changelog scan with dynamic partition pruning.

Are there any user-facing changes?

Queries using native Iceberg scan can read fewer partitions/files when Spark dynamic partition pruning applies. No API change.

How was this patch tested?

Added AuronIcebergIntegrationSuite cases.

@lyne7-sc

lyne7-sc commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @weiqingy for the review. I addressed the concrete issues and kept the shim boundary intentionally. PTAL

@weiqingy

weiqingy commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for the quick turnaround. The concrete fixes read well: letting prepare / waitForSubqueries failures propagate instead of swallowing them, the explicit logWarning on the unfiltered fallback in NativeIcebergTableScanExec, and calling the public prepare() directly. The shim-boundary point is settled on the thread. Nothing further from me — I'll leave the final call to the maintainers.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for Spark runtime filters (used by dynamic partition pruning) to Auron’s native Iceberg scan path by carrying BatchScanExec.runtimeFilters into native execution and re-planning Iceberg partitions with those filters applied at runtime, plus integration coverage for common formats and changelog scans.

Changes:

  • Thread runtime filters into NativeIcebergTableScanExec and re-plan Iceberg scan tasks/partitions with runtime filters before native execution.
  • Cache runtime-filtered Iceberg scan plans separately from static scan plans and add a Spark-version shim for copying BatchScanExec with runtime filters.
  • Add Iceberg integration tests covering dynamic partition pruning for Parquet/ORC, empty-pruning, and changelog scans.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
thirdparty/auron-iceberg/src/test/scala/org/apache/auron/iceberg/AuronIcebergIntegrationSuite.scala Adds integration tests and helpers to assert native Iceberg scan sees runtime filters and DPP reduces files/partitions (including empty-pruning and changelog join).
thirdparty/auron-iceberg/src/main/scala/org/apache/spark/sql/execution/auron/plan/NativeIcebergTableScanExec.scala Carries runtime filters into the native scan node, re-plans Iceberg scan with runtime-filtered partitions, and canonicalizes including runtime filters.
thirdparty/auron-iceberg/src/main/scala/org/apache/spark/sql/auron/iceberg/IcebergScanSupport.scala Adds runtime-filter-aware plan caching and reflective extraction of runtime-filtered partitions (filteredPartitions) when available.
thirdparty/auron-iceberg/src/main/scala/org/apache/spark/sql/auron/iceberg/IcebergConvertProvider.scala Passes BatchScanExec.runtimeFilters into NativeIcebergTableScanExec.
spark-extension/src/main/scala/org/apache/spark/sql/auron/Shims.scala Introduces shim API to copy BatchScanExec while preserving runtime filters across Spark versions.
spark-extension-shims-spark/src/main/scala/org/apache/spark/sql/auron/ShimsImpl.scala Implements copyBatchScanExecWithRuntimeFilters for Spark 3.0–4.1 constructor signature differences.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +421 to +434
private def runtimeFilteredPartitions(exec: BatchScanExec): Option[Seq[InputPartition]] = {
if (exec.runtimeFilters.isEmpty) {
return None
}

exec.prepare()
MethodUtils.invokeMethod(exec, true, "waitForSubqueries")
invokeDeclaredMethod(exec, "filteredPartitions") match {
case Some(seq: scala.collection.Seq[_]) =>
Some(flattenPartitions(seq))
case _ =>
None
}
}
@SteNicholas

Copy link
Copy Markdown
Member

@lyne7-sc, please address the review comments of Copilot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support runtime filters for native Iceberg scan

4 participants